package com.xpec.c4.db.model.global;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.GenericGenerator;

import com.xpec.c4.db.model.log.basic.BasicLogModel;



@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Table(name = "ipfilter", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }) })
public class DBIpFilterModel extends BasicLogModel implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7065573119679458430L;
	
	/**
	 * hibernate需要的沒特別用意
	 */
	protected int id;

	/**
	 * 
	 */
	protected String rule;
	
	/**
	 * 
	 */
	protected String name;
	
	/**
	 * 
	 */
	protected String remark;

	/**
	 * 
	 */
	public static final int ALLOW = 0;
	
	/**
	 * 
	 */
	public static final int DANY = 1;
	
	/**
	 * 0: allow
	 * 1: dany
	 */
	protected int status;
	
	/**
	 * 是否停用
	 */
	protected boolean disable;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@GenericGenerator(name="increment", strategy = "increment")
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(nullable = true)
	public String getRule() {
		return rule;
	}

	public void setRule(String rule) {
		this.rule = rule;
	}

	@Column(name = "status", nullable = true, columnDefinition = "int(11) default 0")
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	@Column(name = "disable", nullable = false, columnDefinition = "boolean default false")
	public boolean isDisable() {
		return disable;
	}

	public void setDisable(boolean disable) {
		this.disable = disable;
	}

	@Column(nullable = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(nullable = true)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

}
